package valuecomusa.fijibus.eticket;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import valuecomusa.fijibus.eticket.shorthaul.R;

public class SunbeamSpinnerAdapter extends ArrayAdapter<String>
{
	private Context context;
	
	SunbeamSpinnerAdapter(Context ctx)
	{
		super(ctx, R.layout.spinner_item_simple);
		context=ctx;
	}
	
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) 
	{
		// TODO Auto-generated method stub
		return getCustomView(position, convertView, parent, true);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return getCustomView(position, convertView, parent, false);
	}
	
	public View getCustomView(int position, View convertView, ViewGroup parent, boolean IsDropDownView) 
	{
		View row=convertView;
		//CampaignHolder holder;
		
      if (row==null) {                          
        LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if(IsDropDownView)
        	row=inflater.inflate(R.layout.spinner_item_simple, parent, false);
        else
        	row=inflater.inflate(R.layout.spinner_item_selector, parent, false);
      }
      
      //MakeModel mm=getItem(position);
      String stemp=getItem(position);
      TextView title=(TextView)row.findViewById(R.id.textView1);
      title.setText(stemp);
      return(row);
	}
	
}
